package com.gitee.wsl.net.server.upload

import io.ktor.http.ContentType
import kotlinx.datetime.Instant
import kotlinx.serialization.Serializable
//import kotlin.js.JsExport

interface UploadsService {
    /**
     * Delete by [Uploads.fileName]
     */
    fun deleteByFileName(
        fileName: String
    )

    /**
     * Create entity
     */
    fun insert(
        fileName: String,
        contentType: ContentType,
        originalFileName: String
    )
    /**
     * Get upload without relations with [Categories] or [Products]
     */
    fun getAllWithoutRelations():List<UploadEntity>
}

/**
 * Exposed entity
 */
class UploadEntity(var fileName :String,
                   var fileMime  :String,
                   var originalFileName  :String,
                   var createAt :Instant)  {

}

/**
 * Response upload files
 */
@Serializable
data class UploadResponse(
    val id: Int,
    val fileName: String,
    val fileMime: String,
    val originalFileName: String,
    val createAt: String,
)